

--------------------------------------------------
-- Level code
-- Created 7:58 2019-8-31
--------------------------------------------------

-- Run code on level start
function onStart()
	if globalsave.Cat then
		triggerEvent("Secret")
	end
end

-- Run code every frame (~1/65 second)
-- (code will be executed before game logic will be processed)
function onTick()
	--Your code here
end

-- Run code when internal event of the SMBX Engine has been triggered
-- eventName - name of triggered event
function onEvent(eventName)
	if eventName == "Secret" then
		globalsave.Cat = true
	end
end

function onNPCKill(eventObj, npcObj, npcKillReason) 
	if npcObj.id == 39 and npcKillReason == 3 then
		NPC.spawn(97, npcObj.x, npcObj.y, npcObj.section)
	end
end